import redis
from shuogg import random_util

try:
    myredis = redis.StrictRedis(host='localhost', port=6379)
except Exception as e:
    print(e.message)

THE_KEY = 'shuoGGStudents'

def add_100_elemments():
    for i in range(100):
        myredis.hset(THE_KEY, random_util.uuid1(), random_util.num(100))

def scan_all():
    cursor_v = -1
    while cursor_v != 0:
        cursor_v = 0 if cursor_v==-1 else cursor_v
        ret_v = myredis.hscan('uuu', cursor_v)
        cursor_v = ret_v[0]
        print(len(ret_v[1]))
        print(ret_v)

if __name__ == '__main__':
    scan_all()
